home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 8 / The Arsenal Files Collection #8 (Arsenal Computer) (1996).ISO / dosutils / tsbat50.zip / DELPATH.BAT < prev    next >
DOS Batch File  |  1992-08-30  |  2KB  |  61 lines

  1. echo off
  2. echo.
  3. echo ┌───────────────────────────────────────────────────┐
  4. echo │ Delete a directory from the path variable         │
  5. echo │ By Prof. Timo Salmi, ts@uwasa.fi, Sun 30-Aug-1992 │
  6. echo └───────────────────────────────────────────────────┘
  7. echo.
  8.  
  9. if "%1"=="" goto _help
  10. if "%2"=="" goto _makeaux
  11. echo The extra parameters are ignored: %2 %3 %4 %5 %6 %7 %8 %9
  12.  
  13. rem Build the auxiliary batch that DELPATH.BAT needs to call
  14. :_makeaux
  15. echo rem SETVAR.BAT, An auxiliary batch needed for DELPATH.BAT> setvar.bat
  16. echo if "%%_newpath%%"=="" goto _new>> setvar.bat
  17. echo set _newpath=%%_newpath%%;%%1>> setvar.bat
  18. echo goto _out>> setvar.bat
  19. echo :_new>> setvar.bat
  20. echo set _newpath=%%1>> setvar.bat
  21. echo :_out>> setvar.bat
  22.  
  23. rem Change the directory-name parameter to upper case
  24. set _stash=%path%
  25. path %1
  26. set _dir=%path%
  27. path %_stash%
  28. set _stash=
  29.  
  30. rem Check that the auxiliary file setvar.bat is available
  31. if exist setvar.bat goto _build
  32. echo Could not make the auxiliary setvar.bat (disk read-only?)
  33. goto _out
  34.  
  35. rem Build the path anew
  36. :_build
  37. set _newpath=
  38. for %%d in (%path%) do if not "%%d"=="%_dir%" call setvar %%d
  39. path %_newpath%
  40. goto _out
  41.  
  42. :_help
  43. echo Usage: DELPATH [Directory]
  44. echo.
  45. echo MsDos version 3.30 required.
  46. echo.
  47. echo If you get an "Out of environment space" message, increase your
  48. echo environment space by using shell configuration in config.sys:
  49. echo Example: shell=c:\bin\command.com /e:1024 /p
  50. echo.
  51. echo Current path %path%
  52. goto _out2
  53.  
  54. :_out
  55. set _newpath=
  56. set _dir=
  57. if exist setvar.bat del setvar.bat > nul
  58. path
  59. :_out2
  60. echo on
  61.